#ifndef FOC_OPENLOOP_SPEED_H
#define FOC_OPENLOOP_SPEED_H

/* 宏定义 */
#include <stdint.h>
#define PWM_TIM_HANDLE htim3
#define PWM_TIM_CHANNEL_A TIM_CHANNEL_2
#define PWM_TIM_CHANNEL_B TIM_CHANNEL_3
#define PWM_TIM_CHANNEL_C TIM_CHANNEL_4
#define PWM_PERIOD 36000
#define POLE_PAIR 7
#define VOLTAGE_POWER_SUPPLY 12

#define _constrain(amt, low, high)                                             \
  ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
#define PI 3.14159265358979323846f
#define _3PI_2 4.71238898038f

/* 函数声明 */
//接口函数
float foc_get_angle(void);
float foc_get_speed(void);
float foc_pid_output(float now_value);
//内部功能函数
void setPwm(float Ua, float Ub, float Uc);
void setPhaseVoltage(float Uq, float angle_el);
float velocityOpenloop(float target_velocity);
//任务函数
void foc_task(void);



/* 全局变量声明 */

#endif // FOC_OPENLOOP_SPEED_H

